package org.springblade.modules.restaurant.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.modules.restaurant.service.IAreaService;
import org.springblade.modules.restaurant.vo.AreaVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author harry
 * @公众号 Harry技术
 */
@RestController
@AllArgsConstructor
@RequestMapping("/api/restaurant/area")
@Tag(name = "API - 区域")
public class ApiAreaController {

	private IAreaService areaService;

	/**
	 * 区域树
	 * @param type 1 区域 2 房间
	 * @return
	 */
	@GetMapping("/tree")
	@Operation(summary = "树形结构", description = "树形结构")
	public R<List<AreaVO>> tree(Integer type) {
		List<AreaVO> tree = areaService.tree(type);
		return R.data(tree);
	}
}
